package com.geeguo.ebuilder.client.base.security.model;

import com.geeguo.ebuilder.client.base.core.dictionary.DefaultRoleEnum;
import com.geeguo.ebuilder.core.security.model.BaseLoginUser;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.collections4.CollectionUtils;

/**
 * 登录者信息
 */
@Getter
@Setter
public class LoginUser extends BaseLoginUser {

    /**
     * 用户名
     */
    private String username;
    /**
     * 姓名
     */
    private String realName;
    /**
     * 组织ID
     */
    private String orgId;
    /**
     * 租户编码
     */
    private String tenantCode;
    /**
     * 终端类型
     */
    private int clientType;

    public boolean isSuperAdmin() {
        if (CollectionUtils.isNotEmpty(this.getRoles())) {
            return this.getRoles().contains(DefaultRoleEnum.SuperAdmin.getCode());
        }
        return true;
    }
}